package simulation;

import java.awt.Dimension;


public class Muscle extends Spring {
	private double PI=3.14;
	private double timer;
	private double CHANGE_RATE=0.04;
	private double myAmplitude;
	private double restLength;
	
	public Muscle(Mass start, Mass end, double length, double kVal, double amplitude){
		super( start,  end, length,  kVal);
		restLength=length;
		timer=0;
		myAmplitude=amplitude;
		
	}
    /**
     * XXX.
     */
    @Override
    public void update (double elapsedTime, Dimension bounds) {
    	timer+=CHANGE_RATE;
    	timer=timer%(2*PI);
    	super.setLength(restLength+Math.cos(timer)*myAmplitude);
    	super.update(elapsedTime, bounds);
    	
    	
    	
    }
	

}
